package com.etone.smartAudit.enums;

import lombok.Getter;

/**
 * @author: sovy
 * @date: 2020/8/31
 * @description:
 */
public enum UpdateFrequency {
    DAY("天"),
    MONTH("月"),
    YEAR("年"),
    NOT("不定时"),
    ;
    @Getter
    public String value;

    UpdateFrequency(String value) {
        this.value = value;
    }

    /**
     * 根据value获取枚举
     *
     * @param value
     * @return
     */
    public static UpdateFrequency getByValue(String value) {
        if (value == null) {
            return null;
        }
        UpdateFrequency[] values = UpdateFrequency.values();
        for (int i = 0; i < values.length; i++) {
            if (value.equals(values[i].getValue())) {
                return values[i];
            }
        }
        return null;
    }
}
